package com.xxg.renrenorder.dao.bean;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 订单主表
 *
 * @author xxg
 * @date 2020/11/16
 */
@Data
@Document(collection = "orderMasterInfo")
@ApiModel(value = "OrderMasterInfo", description = "订单信息参数")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OrderMasterInfo {
    @ApiModelProperty(value = "订单ID", hidden = true)
    private String id;
    @ApiModelProperty(value = "会员ID", hidden = true)
    private Integer userId;
    @ApiModelProperty(value = "会员分组ID", hidden = true)
    private Integer userGroupId;
    @ApiModelProperty(value = "商品所在店铺Id", hidden = true)
    private Integer shopId;
    @ApiModelProperty(value = "订单创建时间", hidden = true)
    private Date createTime;
    @ApiModelProperty(value = "订单更新时间", hidden = true)
    private Date updateTime;
    @Valid
    @NotNull(message = "addressInfo不能为null")
    @ApiModelProperty(value = "收货地址信息", required = true)
    private AddressInfo addressInfo;
    @ApiModelProperty(value = "订单状态", hidden = true)
    private Integer orderStatus;
    @ApiModelProperty(value = "支付信息", hidden = true)
    private PaymentInfo paymentInfo;
    /**
     * 是否删除，false-未删除，true-已删除
     */
    @ApiModelProperty(value = "是否删除", hidden = true)
    private Boolean deleted;
    @Valid
    @NotNull(message = "productInfos不能为null")
    @ApiModelProperty(value = "订单中商品列表", required = true)
    private List<ProductInfo> productInfos;
    @ApiModelProperty(value = "订单总价", hidden = true)
    @Field(targetType = FieldType.DECIMAL128)
    private BigDecimal total;
    @ApiModelProperty(value = "商品总价", hidden = true)
    @Field(targetType = FieldType.DECIMAL128)
    private BigDecimal totalPrice;
    @ApiModelProperty(value = "总的优惠", hidden = true)
    @Field(targetType = FieldType.DECIMAL128)
    private BigDecimal totalDiscount;
    @ApiModelProperty(value = "实际支付总金额/需要支付总金额", hidden = true)
    @Field(targetType = FieldType.DECIMAL128)
    private BigDecimal totalPay;
    @ApiModelProperty(value = "手续费", hidden = true)
    @Field(targetType = FieldType.DECIMAL128)
    private BigDecimal commission;
    @ApiModelProperty(value = "手续费信息")
    private CommissionInfo commissionInfo;
    @ApiModelProperty(value = "优惠券优惠总额")
    @Field(targetType = FieldType.DECIMAL128)
    private BigDecimal totalCouponDiscount;
    @ApiModelProperty(value = "运费", hidden = true)
    private BigDecimal expressFee;
    @ApiModelProperty(value = "运费退款", hidden = true)
    private BigDecimal refundExpressFee;
    @ApiModelProperty(value = "没有退的运费总额", hidden = true)
    private BigDecimal unRefundExpressFee;
    @ApiModelProperty(value = "发票抬头")
    private String receipt;
    @ApiModelProperty(value = "发票税号")
    private String taxNo;
    @ApiModelProperty(value = "不同状态分组数量", hidden = true)
    private Integer count;
    @ApiModelProperty(value = "物流信息", hidden = true)
    private ExpressInfo expressInfo;
    @ApiModelProperty(value = "支付金额不对", hidden = true)
    private Boolean payException;
    @ApiModelProperty(value = "订单发货时间", hidden = true)
    private Date expressTime;
    @ApiModelProperty(value = "订单成交时间/关闭时间", hidden = true)
    private Date doneTime;
    @ApiModelProperty(value = "超过15天售后关闭，true-关闭", hidden = true)
    private Boolean closeAfterSales;
    @Min(value = 0, message = "expressType字段不能小于0")
    @Max(value = 4, message = "expressType字段不能大于4")
    @ApiModelProperty(value = "运费类型(1-运费到付)")
    private Integer expressType;
    @ApiModelProperty(value = "订单备注")
    private String remark;
    @ApiModelProperty(value = "订单类型 1-普通订单 2-带货订单", hidden = true)
    private Integer orderType;
    @ApiModelProperty(value = "操作列表", hidden = true)
    private List<OperationInfo> operationInfos;

}
